<template>
  <div>
     <input placeholder="输入关键字搜索"  v-model="doctor" @blur="au">
    <table class="my-table">
      <thead>
        <tr>
         <slot name="top"></slot>
        </tr>
      </thead>
      <tbody>
        <tr v-for="item in list" :key="item.id">
          <td>{{item.date}}</td>
          <td>{{item.doctor}}</td>
          <td>{{item.diagnosis}}</td>
          <td>{{item.prescription}}</td>
          <td @click="add(item.id)">详情</td>
        </tr>
      </tbody>
    </table>
  </div>
</template>

<script>
export default {
      name:"HmBiao",
      data () {
          return {
            doctor:""  
          }
      },
      props:{
        list:{
          type:Array,
          required:true,
        }
      },
      methods:{
        au(){
         this.$emit("au",this.doctor)
        },
        add(id){
          this.$emit("add",id);
        }
      }
}
</script>

<style scoped>
  .my-table {
    border-collapse: collapse;
    width: 100%;
  }

  .my-table td, .my-table th {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
  }

  .my-table th {
    background-color: #f2f2f2;
  }
</style>